<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<head>
 	<meta http-equiv="Cache-Control" content="no-cache"/>
	<title> Web rezervacije</title>
</head>

<f:view>
  	<h1>Prijavljen korisnik: <h:outputText value="#{users.user.username}" /> </h1>
  	<h3>Spisak letova za putnika: <h:outputText value="#{passengers.passenger.ime}" />&nbsp;
  									<h:outputText value="#{passengers.passenger.prezime}" /> </h3>
  	
  	<table border="1" width="80%">
  	<tr bgcolor="lightgrey"><th width="10%">Redni broj</th><th width="20%">ID leta</th><th width="20%">Vreme polaska</th><th width="20%">Vreme dolaska</th><th width="30%">Polazni aerodrom</th><th width="30%">Odrediste</th><th width="10%">Otkaz rezervacije</th></tr>
  		
  		<ui:repeat value="#{flights.allFlights}" var="flight">
  		
  		<tr>
  		<td><h:outputLink value="listFlightServlet?listPassenger=#{flight.idLeta}">
  			<h:outputText value="#{flights.allFlights.indexOf(flight)+1}"/></h:outputLink></td>
  			
		<td><h:outputLink value="listFlightServlet?listPassenger=#{flight.idLeta}">
			<h:outputText value="#{flight.idLeta}"/></h:outputLink></td>
			
		<td><h:outputLink value="listFlightServlet?listPassenger=#{flight.idLeta}">
			<h:outputText value="#{flight.vremePolaskaString}"/></h:outputLink></td>
			
		<td><h:outputLink value="listFlightServlet?listPassenger=#{flight.idLeta}">
			<h:outputText value="#{flight.vremeDolaskaString}"/></h:outputLink></td>
			
		<td><h:outputLink value="listFlightServlet?listPassenger=#{flight.idLeta}">
			<h:outputText value="#{flight.polaziAerodrom}"/></h:outputLink></td>
			
		<td><h:outputLink value="listFlightServlet?listPassenger=#{flight.idLeta}">
			<h:outputText value="#{flight.odrediste}"/></h:outputLink></td>
			
		<td><h:outputLabel rendered="#{flight.otkazi}">
			<h:outputLink value="CancelServlet?flightId=#{flight.idLeta}"><h:outputText value="Otkazi"/></h:outputLink>
			</h:outputLabel>
			<h:outputLabel rendered="#{flight.otkazi==false}">
			<h:outputText value="Istekao rok otkaza"/>
			</h:outputLabel>
			</td>
		</tr>
		  
  		</ui:repeat>
	</table>
  
 	<p><h:outputLink value="listFlightServlet?listFlight=flights">Spisak svih letova</h:outputLink></p>	
</f:view>

</html>